import { App } from "vue"

export const withInstall = <T extends { install?: (app: App) => void, name: string }>(component: T) => {
  component.install = (app: App) => {
    app.component(component.name, component)
  }
  return component as T & Plugin
}